﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Models;
using BLL;
using System.Data;
using System.Net;

namespace Dryricenet.houTai
{
    public partial class FH : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                string name = Session["UserName"].ToString();
                DataTable dt = userBLL.selectNameBll(name);
                DataRow dr = dt.Rows[0];//第一条数据
                int userID = Convert.ToInt32(dr["UserID"].ToString());
                int id = Convert.ToInt32(Request.QueryString["UserID"]);
                int glid=Convert.ToInt32(userBLL.idGLBLL(id));
                Log l = new Log();
                l.OperTime = DateTime.Now;
                l.OperPerson = name;
            if (glid==2)
                {
                    if (userID == 1)
                    {
                    l.Type = "封号管理员";
                    l.State = "封号成功";
                    l.ComputerName = Dns.GetHostName().ToUpperInvariant();
                    l.System = Systems.GetOSNameByUserAgent(Environment.OSVersion.ToString());
                    l.UserID = userID;
                    LogBLL.LogAddBLL(l);
                    userBLL.updateFHBll(id);
                        Response.Redirect("userSelect.aspx");
                    }
                    else
                    {
                        Response.Write("<script>alert('您不是超级管理员无法封号管理员！')</script>");
                    
                    }
                }
                else
                {
                l.Type = "封号用户";
                l.State = "封号成功";
                l.ComputerName = Dns.GetHostName().ToUpperInvariant();
                l.System = Systems.GetOSNameByUserAgent(Environment.OSVersion.ToString());
                l.UserID = userID;
                LogBLL.LogAddBLL(l);
                userBLL.updateFHBll(id);
                    Response.Redirect("userSelect.aspx");
                }
        }
    }
}